<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  /* .box {
    width: 300px;
    height: 300px;
    margin: 100px auto;
  }

  img {
    width: 300px;
    height: 300px;
  } */
  body {
    background-image: url(../作业/王者荣耀images/1.webp);
  }
</style>

<body>
  <!-- <div class="box">
    <img src="../作业/王者荣耀images/1.webp" alt="">
  </div> -->

  <script>
    // const pic = document.querySelector('img')
    let a = Math.floor(Math.random() * 15) + 1
    console.log(a);

    document.body.style.backgroundImage = `url(../作业/王者荣耀images/${a}.webp)`
    // console.log(a);
    // pic.src = `../作业/王者荣耀images/${a}.webp`
  </script>
</body>

</html>